1. Field of the Invention
Aspects of the present invention relate to a nonvolatile memory. More particularly, aspects of the present invention relate to an apparatus and method for efficiently using a nonvolatile memory.
2. Description of the Related Art
Nonvolatile memories are widely used as storage media to store and handle data in embedded systems such as electronic appliances, communication devices, set-top boxes and mobile devices. Flash memory, which is a widely used kind of nonvolatile memory, can electrically erase and re-record data, and is appropriate for use in a mobile device because flash memory consumes less power compared to a storage media based on magnetic disks, has an initial access time that is short, and has a size that is small. Such a nonvolatile memory has multiple blocks that include multiple pages. Sizes of each block can be 16, 64, 128 or 256 KB (kilobyte) depending on the number of pages and the size of the pages that are included in each block. For a nonvolatile memory, a page refers to a unit for writing data in the nonvolatile memory, and a block refers to a unit for deleting the data in the nonvolatile memory.
A process where data is recorded in a nonvolatile memory is described below. First, if power is provided to the nonvolatile memory, all blocks of the nonvolatile memory are scanned, which establishes information of free blocks, which are blocks that include no data. If the information on the free blocks are established, the free blocks are arranged in an ascending order of an erasure count, from the lowest erasure count to the highest erasure count so that if there is an allocation request of the free blocks, the arranged free blocks are allocated to store data in a given order.
Because of such a characteristic of the nonvolatile memory, in order to rewrite a new data bit on the page where data bits are already stored, the whole block that includes the page should be first deleted. However, if the erasure count of the block exceeds a certain level, a bad block is generated, in which bits are fixed to a certain value. In a nonvolatile memory, bad blocks are the most important factor that decreases the life of the nonvolatile memory. In order to prevent the generation of bad blocks, the blocks of the nonvolatile memory need to be used evenly.
However, according to a related nonvolatile memory, a problem arise, whereby when allocating the free blocks in the given order to store certain data, the free blocks are allocated simply according to the erasure count of free blocks without considering the characteristics of the data to be stored. Accordingly, using the blocks of the nonvolatile memory evenly becomes difficult. For example, free blocks whose erasure counts are low may be used to store data that is not frequently updated, while free blocks whose erasure counts are high may be used to store data that are frequently updated. Such inefficient use of blocks promotes the generation of bad blocks.
Further, according to a related art nonvolatile memory, a problem arises because free blocks are allocated simply according to the erasure count of free blocks without considering the spatial relationship of the free blocks making it difficult to store data in neighboring free blocks.